<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/commons/taglibs.jsp"%>
<%@ include file="/static/commons/meta.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 	<title>${title }</title>
	<!--自定义index样式-->
	<link rel="stylesheet" href="${ctx }/static/styles/basic/basic.css" />
	<link rel="stylesheet" href="${ctx }/static/styles/edit/box.css" />
	<!--js库-->
	<%@ include file="/static/commons/jquery-easyui.jsp" %>
	<script language="JavaScript" src="${ctx}/static/scripts/set_select.js"></script>
	<script language="JavaScript" src="${ctx}/static/scripts/common.js"></script>
	<script type="text/javascript" src="${ctx}/static/widgets/uploadify/swfobject.js"></script>
	<script type="text/javascript" src="${ctx}/static/widgets/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
	<style>
		.uploadBtn,.downloadedBtn{
	   		width:88px;
			height:28px;
			float: left;
			margin: 5px 0 5px 5px;
			cursor:pointer;
	   }
	   .uploadBtn {
			background-image:url("${ctx}/static/widgets/uploadify/view_btn.png");
		}
		#importFileUploader{margin-top:5px;margin-bottom:5px;}
		#importFileUploader,#importFileQueue{float:left;}
	</style>
  </head>
  
  <body style="padding-bottom:8px;">
  		<c:set var="em" value="<span>*</span>"></c:set>
  		<c:set var="disabled" value=""></c:set>
  		<c:set var="ifSelect" value=""></c:set>
  		<c:set var="noChange" value=""></c:set>
  		<c:set var="isImportant" value="true"></c:set>
  		<c:if test="${not empty view}">
  			<c:set var="disabled" value="disabled"></c:set>
  			<c:set var="ifSelect" value="false"></c:set>
  			<c:set var="em" value=""></c:set>
  			<c:set var="isImportant" value=""></c:set>
  		</c:if>
  		<c:if test="${not empty role.user_id}">
	  		<c:set var="noChange" value="disabled"></c:set>
  		</c:if>
  		<form id="editForm" action="${ctx}/sign/save" method="post">
  			<input type="hidden" value="${obj.sign_id}" id="signId" name="p_signId" />
  			<div class="box">
	  			<table cellspacing="0" cellpadding="0">
	  				<tbody>
						<tr>
							<td class="message">
								<p><span>*</span>人员：</p>
							</td>
							<td colspan="1">
								<vvise:select id="userId" name="p_userId" sqlname="getUser" className="wd170" width="99%"
	  								defval="${obj.user_id}" ifSelect="${ifSelect}" />
							</td>
						</tr>
						<tr>
							<td class="message">
								<p><span>*</span>签名：</p>
							</td>
							<td>
								<input type='hidden' id="imgUrl" name="p_imgUrl" value="${obj.img_url }" />
								<c:if test="${empty view}">
									<input type="file" id="importFile" name="importFile" class="f_l" style="margin:6px 6px 0 0;" />
								</c:if>
								<input type="button" class="uploadBtn f_l" onclick="viewImg()" style="border:0px; outline:none;">
							</td>
						</tr>
						<tr>
							<td class="message">
								<p>备注：</p>
							</td>
							<td>
								<input type="text" id="remark" name="p_remark" value="${obj.remark }"
									class="wd170 " ${disabled } maxLength="40" style="width: 100%;" />
							</td>
						</tr>
					</tbody>
	  			</table>
	  		</div>
        </form>
        <script type="text/javascript">
        	$(function(){
        		$("#importFile").uploadify({
        			'uploader'     : '${ctx}/static/widgets/uploadify/uploadify.swf?var='+(new Date()).getTime(),
           			 'script'      : '${ctx}/UploadImg?folder=sign',
		            'cancelImg'   : '${ctx}/static/widgets/uploadify/cancel.png',
		            'fileDesc'    : '*.png,*.jpg',
		            'sizeLimit'   : 5000000,
		             'auto'       : true,//是否直接上传
		            'fileExt'	  : '*.png,*.jpg',
		            'queueID'     : 'fileQueue',
		            'simUploadLimit' : '1',
		            'buttonText'     : '',
		            'buttonImg'      : '${ctx}/static/widgets/uploadify/upload_btn.gif',
		            'height':'28',
		            'width':'88',
		            'onComplete'  : function(event, ID, fileObj, response, data) {
		            	$('#imgUrl').val(response);
				   },
				   'onError'     : function (event,ID,fileObj,errorObj) {
					     parent.$.messager.alert('提示信息','上传失败','info');
				   }     
			   });
        	});
        	function viewImg(){
        		var pp = parent;
        		var path = $('#imgUrl').val();
        		if(isEmpty(path)){
        			pp.$.messager.alert('提示信息','未上传签名','info');
        			return;
        		}
        		window.open('${ctx}'+path);
        	}
        </script>
  </body>
</html>